{% extends "cartoon/cartoonbase.html" %}
{% block title %}
    <title>新增Cartoon</title>
{% endblock %}
{% block content %}
<form action="" method="post">
    <h1>新增Cartoon</h1>
    <table>
        {{ form.as_table }}
    </table>

    <div class="demo-box">
        <p><input type="submit" value="增加" ></p>
    {% if cartoons %}
        <table border="1px" cellspacing="0px">
            <tr>
                <th align=left width="20%">Name</th>
                <th align=left width="20%">Path</th>
                <th align=left width="5%">Episodes</th>
                <th align=left width="10%">Company</th>
                <th align=left width="15%">Date</th>
                <th align=left width="10%%">Formats</th>
                <th align=left width="15%">Pictures</th>
            </tr>

            {% for cartoon in cartoons %}
                <tr>
                    <td width="20%">{{ cartoon.name }}</td>
                    <td width="20%">{{ cartoon.path }}</td>
                    <td width="5%">{{ cartoon.episodeNum }}</td>
                    <td width="10%">{{ cartoon.company }}</td>
                    <td width="15%">{{ cartoon.date|date:"Y-m-d" }}</td>
                    <td width="10%">
                        {% for format in cartoon.vFormats.all %}
                            <p>{{ format }}</p>

                        {% endfor %}


                    </td>

                    <td width="15%">
                        {% for pic in cartoon.cartoonpicture_set.all %}
                            <a href="{{ pic.getImgUrl }}" width="60" height="40" rel="lightbox[{{ img.pname }}]">
                                <img src={{ pic.getThumbUrl }}>
                            </a>
                        {% endfor %}
                    </td>
                    <td width="10%">
                        <a href="{{ cartoon.getId }}/edit" target=”_blank”>编辑</a>
                        <a href="{{ cartoon.getId }}/deletecartoonpre" target=”_blank”>删除</a>
                    </td>
                </tr>
            {% endfor %}
        </table>
    {% endif %}
    </div>


</form>
{% endblock %}